package hpssim;

public class Job {
    /*
     * JOB RECORD
     * T_a Classification PriorityProcess PrioritySched DeviceSched RunCPU RunGPU TimeRemaining TqTeTr
     *
     */

    public int ta; /*arrival time*/
    public int classification; /*classification: 0 cpu 1 gpu */
    public int pp; /*process priority*/
    public int ps; /*scheduling priority*/
    public int devicesched; /*scheduled device*/
    public int rcpu;
    public int rgpu; /*execution time (cpu or gpu)*/
    public int trem; /*remaining time*/
    public int tq; /*queue time*/
    public int te; /*execution time*/
    public int tfinalize; /**/
    public int rescheduled ;
    public int type; /*O realttime 1 user*/
    public static int current_id = 0;
    public int id;

    /*
     * Costructor
     */
    public Job(int ta, int rcpu, int rgpu, int type) {
        this.ta = ta;                
        this.rcpu = rcpu;
        this.rgpu = rgpu;
        this.tq = 0;
        this.te = 0;
        this.tfinalize = 0;
        this.rescheduled = 0;
        this.pp = 0;
        this.ps = 0;
        this.id = this.current_id++;
    }
    public Job(int ta){
        this.ta = ta;
        this.tq = 0;
        this.te = 0;
        this.tfinalize = 0;
        this.rescheduled = 0;
        this.id = this.current_id++;
        this.pp = 0;
        this.ps = 0;
    }
    public Job() {
        this.id = this.current_id++;
    }
    /*
     * Set methods
     */
    public void printJob(){
        System.out.println("ID "+this.id   +" TA " 
                              +this.ta   + " " 
                              +this.type +" | "
                    +"class " +this.classification+ " CPU and GPU timeservice "
                              +this.getrcpu()+" "
                              +this.getrgpu());
    }    
    public void printjobstat(){
        System.out.println("id "   +this.id   + 
                           " Ta "   +this.ta   +  
                           " Type " +this.type +
                           " Class "+this.classification + 
                           " Resch "+this.rescheduled +
                           " Trun "  +this.gettq()+ 
                           " Te "   +this.gette()+ 
                           " Fin "   +this.getfinalize());
    }
    public void setdevicesched(int device) {
        this.devicesched = device;
    }
    public void setclass(int classification) {
        this.classification = classification;
    }
    public void settrem(int trem) {
        this.trem = trem;
    }

    public void setpp(int pp) {
        this.pp = pp;
    }

    public void setps(int ps) {
        this.ps = ps;
    }

    public void setta(int ta) {
        this.ta = ta;
    }

    public void settq(int tq) {
        this.tq = tq;
    }

    public void sette(int te) {
        this.te = te;
    }

    public void settfinalize(int tfinalize) {
        this.tfinalize = tfinalize;
    }
    public void setjobtype(int type){
        this.type = type;
    }
    public void setrcpu(int rcpu){
        this.rcpu = rcpu;
    }
    public void setrgpu(int rgpu){
        this.rgpu = rgpu;
    }
    
    /*
     * Get methods
     */

    public int getclass() {
        return this.classification;
    }

    public int getdevicesched() {
        return this.devicesched;
    }

    public int getpp() {
        return this.pp;
    }

    public int getps() {
        return this.ps;
    }

    public int getta() {
        return this.ta;
    }

    public int gettq() {
        return this.tq;
    }

    public int gette() {
        return this.te;
    }

    public int getfinalize() {
        return this.tfinalize;
    }

    public int getid() {
        return this.id;
    }
    public int getrcpu(){
        return this.rcpu ;
    }
    public int getrgpu(){
        return this.rgpu ;
    }
    public int gettype(){
        return this.type;
    }
}
